package com.black.order.feign.fallback;

import com.black.order.feign.ProductFeignClient;
import com.black.product.bean.Product;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

/**
 * @Author: Young
 * @CreateTime: 2025-08-04
 * @Description: 用于远程请求失败后兜底回调，但要注意项目中是否开启了重试机制
 * @Version: 1.0
 */
@Component
public class ProductFeignClientFallback implements ProductFeignClient {

    @Override
    public Product getProductById(Long productId, String token) {
        Product product = new Product();
        product.setId(productId);
        product.setName("未知商品");
        product.setNumber(1);
        product.setPrice(BigDecimal.valueOf(100.0));
        return product;
    }

}
